import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Demo {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String str1 = in.next();
            String str2 = in.next();
            func(str1,str2);
        }
    }

    private static void func(String str1, String str2) {
        Set<Character> set = new HashSet<>();
        str1 = str1.toUpperCase();
        str2 = str2.toUpperCase();
        for (int i = 0; i < str2.length(); i++) {
            set.add(str2.charAt(i));
        }
        StringBuilder stringBuilder = new StringBuilder();
        Set<Character> set1 = new HashSet<>();
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if(!set.contains(ch) && !set1.contains(ch)){
                set1.add(ch);
                stringBuilder.append(ch);
            }
        }
        System.out.println(stringBuilder.toString());
    }

}
